<%= javascript_include_tag "concerto_simple_rss/application.js" %>
<fieldset>
  <legend><span>RSS</span></legend>
  <%= form.fields_for :config do |config| %>
    <div class="clearfix">
      <%= config.label :url %>
      <div class="input">
        <%= config.url_field :url, :placeholder => 'http://feeds.bbci.co.uk/news/rss.xml', :class => "input-xxlarge", :value => @content.config['url'], "data-url" => preview_contents_path %>
      </div>
    </div>

    <div class="row-fluid">
      <div class="span6">
        <div class="clearfix span6">
          <%= label_tooltip "simple_rss", :url_userid, t("activerecord.attributes.simple_rss.config_url_userid"), tip: t("basic_auth_tip") %>
          <div class="input">
            <%= config.text_field :url_userid, :class => "input-medium", autocomplete: :off %>
          </div>
        </div>
        <div class="clearfix span6">
          <%= config.label :url_password, t("activerecord.attributes.simple_rss.config_url_password") %>
          <div class="input">
            <%= config.password_field :url_password, :class => "input-medium", autocomplete: :off %>
          </div>
        </div>
      </div>
    </div>

    <div class="clearfix">
      <%= config.label :output_format, 'Display Format' %>
      <div class="input">
        <%= config.select :output_format, [["Headlines", "headlines"], ["Articles", "detailed"], ["XSLT", "xslt"]], :selected => @content.config['output_format'] %>
      </div>
    </div>
    <div class="clearfix">
      <%= config.label :reverse_order, 'Reverse order of items?' %>
      <div class="input">
        <%= config.select :reverse_order, [["No", 0], ["Yes", 1]] %>
      </div>
    </div>
    <div class="clearfix" id="simple_rss_maxitems">
      <%= config.label :max_items, 'Maximum items from feed' %>
      <div class="input">
        <%= config.number_field :max_items, :min => 0, :step => 1, :value => @content.config['max_items'] %>
      </div>
    </div>
    <div class="clearfix" id="simple_rss_xslmarkup">
      <%= label_tooltip "simple_rss", :config_xsl, "XSL Markup", :tip => "The XSL Markup field is only used when the Display Format is set to XSLT." %>
      <div class="input">
        <%= config.text_area :xsl, :class => "span12", :rows =>4, :value => @content.config['xsl'] %>
      </div>
    </div>
    <div class="clearfix" id="simple_rss_sanitize_tags">
      <%= label_tooltip "simple_rss", :sanitize_tags, 'Blacklisted HTML Tags for Sanitization', :tip => "Whitelist includes #{[*ActionView::Base.sanitized_allowed_tags].join ' '}" %>
      <div class="input">
        <%= config.text_field :sanitize_tags, :class => "input-xxlarge", :placeholder => 'img a', :value => @content.config['sanitize_tags'] %>
      </div>
    </div>
  <% end %>
</fieldset>
